<?php
/*
 * 主要功能:
 *
 * 56.com - PHP - class.log.php
 * author:	jk
 * date:2007-03-20
 */
class admin_log
{
	static public function flv($flvid,$action,$type = 'u')
	{
		global $db_log;
		$typeArray = array('u','l','p');
		$type	   = in_array($type,$typeArray)?$type:'u';
		$bind	   = self::bind($flvid,$action);
		$table	   = 'check_log_'.$type;
		$db_log->insert($table,$bind);
	}
	static public function review($id,$action)
	{
		global $db_log;
		$bind	   = self::bind($id,$action);
		$table	   = 'review_log';
		$db_log->insert($table,$bind);
	}
	static public function index($id,$action)
	{
		global $db_log;
		$bind	   = self::bind($id,$action);
		$table	   = 'index_log';
		$db_log->insert($table,$bind);
	}
	/*
	 * 
	 * 功能: 取当前管理员ID
	 * 
	 */
	static public function get_cs()
	{
		global $menu;
		return $_SESSION[$menu['adminStr']];		
	}
	static public function date()
	{
		$time 	= time();
		return  array(
			'save_time' 	=> $time,
			'Ymd'				=> date("Ymd", $time),
		);		
	}
	static public function bind($id,$action)
	{
		$id 	= is_array($id)?$id:array($id);
		$time 	= self::date();
		$cs		= self::get_cs();
		foreach($id as &$v)
		{
			$v = array_merge(
								array(
									'data_id' => $v,
									'action'  => $action,
									'cs'	  => $cs,
									'ip'	  => g::ip()			
								),
								$time
							);
		}
		return $id;	
	}
	
}

?>